home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19950528-19950726 / 000377_news@columbia.edu_Mon Jul 17 17:19:44 1995.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA23786
  2.   (5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Mon, 17 Jul 1995 14:53:27 -0400
  3. Received: by apakabar.cc.columbia.edu id AA15422
  4.   (5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Mon, 17 Jul 1995 14:53:26 -0400
  5. Path: news.columbia.edu!panix!news.mathworks.com!uunet!in1.uu.net!news3.digex.net!digex.net!not-for-mail
  6. From: hashmi@cnj.digex.net (Atiqullah Hashmi)
  7. Newsgroups: comp.unix.programmer,comp.protocols.kermit.misc
  8. Subject: dialing program; modem receives dialstring but doesn't dial?
  9. Date: 17 Jul 1995 13:19:44 -0400
  10. Organization: Express Access Online Communications, New Jersey, USA
  11. Lines: 41
  12. Message-Id: <3ue63g$g3n@cnj.digex.net>
  13. Nntp-Posting-Host: cnj.digex.net
  14. Xref: news.columbia.edu comp.unix.programmer:32354 comp.protocols.kermit.misc:3213
  15. Apparently-To: kermit.misc@watsun.cc.columbia.edu
  16.  
  17.  
  18.  
  19. Hi,
  20.  
  21. I have a simple program to dial out via a hayes modem. When run, the
  22. modem RD and TD lights blink showing that it receives the dial string
  23. from the program but doesn't really dial out.
  24. Here is the relevant piece of code. Any help is appreciated.
  25. Thanks
  26.  
  27. Atiq
  28. -------------------------------------
  29. void sttyModem(int fd)
  30. {
  31.         struct termio tbuf;
  32.         if (ioctl(fd, TCGETA, &tbuf) < 0 )
  33.                 cerr << "ioctl(TCGETA) failed; errno = "<< errno << endl;
  34.         tbuf.c_iflag = IXON | IXOFF | ISTRIP | IGNBRK | IGNPAR;
  35.         tbuf.c_oflag = 0;
  36.         tbuf.c_lflag = 0;
  37.         tbuf.c_cflag = B300 | CS7 | CREAD | HUPCL | PARENB;
  38.         tbuf.c_cc[4] = 1;       // MIN
  39.         tbuf.c_cc[5] = 0;       // TIME
  40.         if (ioctl(fd, TCSETAF, &tbuf))
  41.                 cerr << "ioctl(TCSETAF) failed; errno = "<< errno << endl;
  42. }
  43.  
  44. main()
  45. {
  46.     int tty_fd;
  47.     tty_fd=open(....)  etc.
  48.     sttyModem(tty_fd);
  49.  
  50.         char *str="ATDT91(800)222-3333\r";        //some number
  51.     char ss[10];
  52.  
  53.         write(tty_fd, str, strlen(str));
  54.         read(tty_fd, ss, 1);
  55.     // other code..........
  56.     exit(0);
  57. }